const { build } = require('esbuild');

const defaultOptions = {
    stdio: 'inherit',
    minify: true,
};

const version = '2.3.200';

const pdfjsOptions = Object.assign({}, defaultOptions, {
    entryPoints: [`./${version}/pdf.js`],
    outfile: `./${version}/pdf.min.js`,
});

const pdfjsWorkerOptions = Object.assign({}, defaultOptions, {
    entryPoints: [`./${version}/pdf.worker.js`],
    outfile: `./${version}/pdf.worker.min.js`,
});

const buildPromise = Promise.all([
    build(pdfjsOptions),
    build(pdfjsWorkerOptions),
]);
buildPromise.catch(() => process.exit(1));
